import json

data = [{"name": "张三", "age": 16, "gender": None}, {"name": "王五", "age": 16}, {"name": "赵六", "age": 16}]

# 列表转json
js = json.dumps(data, ensure_ascii=False)  # ensure_ascii 不使用ascii转换
print(js)
# 字符串转json
l = json.loads(js)
print(type(l), l)


# 字典转json

d = {"name": "张三", "age": 16, "gender": None}

js2 = json.dumps(d, ensure_ascii=False)
print(js2)
ds = json.loads(js2)
print(type(ds), ds)